/*    */ package com.zimbra.qa.unittest;
/*    */ 
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.db.DbPool;
/*    */ import com.zimbra.cs.db.DbPool.DbConnection;
/*    */ import junit.framework.TestCase;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TestConnectionPool
/*    */   extends TestCase
/*    */ {
/*    */   public void testPool()
/*    */     throws Exception
/*    */   {
/* 36 */     int initialSize = DbPool.getSize();
/*    */     
/* 38 */     ZimbraLog.test.info("Initial connection pool size: %d", new Object[] { Integer.valueOf(initialSize) });
/*    */     
/* 40 */     DbPool.DbConnection conn1 = DbPool.getConnection();
/* 41 */     assertEquals("After first connection", initialSize + 1, DbPool.getSize());
/*    */     
/* 43 */     DbPool.DbConnection conn2 = DbPool.getConnection();
/* 44 */     assertEquals("After second connection", initialSize + 2, DbPool.getSize());
/*    */     
/* 46 */     DbPool.DbConnection maint = DbPool.getMaintenanceConnection();
/* 47 */     assertEquals("After maintenance connection", initialSize + 2, DbPool.getSize());
/*    */     
/* 49 */     DbPool.quietClose(conn1);
/* 50 */     assertEquals("After first close", initialSize + 1, DbPool.getSize());
/*    */     
/* 52 */     DbPool.quietClose(conn2);
/* 53 */     assertEquals("After second close", initialSize, DbPool.getSize());
/*    */     
/* 55 */     DbPool.quietClose(maint);
/* 56 */     assertEquals("After closing maintenance connection", initialSize, DbPool.getSize());
/*    */     
/* 58 */     ZimbraLog.test.info("Final connection pool size: %d", new Object[] { Integer.valueOf(DbPool.getSize()) });
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/TestConnectionPool.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */